#!/usr/bin/env python3
# -*- coding: utf-8 -*-
############################################################################################
# @Author: DengLibin 榆霖
# @Date: Create in 2022-03-30 21:14:24
# @Description: kNN k近邻算法
############################################################################################

import operator

import numpy as np

from kNN import classify0


def create_data_set():
    """创建数据集

    Returns:
        _type_: _description_
    """
    # 4组数据(4行)，每组 2个属性（特征）
    group = np.array([[1.0, 1.1],
                      [1.0, 1.0], 
                      [0,     0], 
                      [0,   0.1]])
    #标签(每行所属类别)
    labels = ['A', 'A', 'B', 'B']
    return group, labels



if __name__ == '__main__':
    inx = [0.5, 0.5]
    data_set, labels = create_data_set()
    target_label = classify0(inx, data_set, labels, 4)
    print("target_label", target_label)
